/*
 * Circuit.h
 *
 *  Created on: Jan 13, 2012
 *      Author: luiz
 */

#ifndef CIRCUIT_H_
#define CIRCUIT_H_

#include <map>
#include <string>

#include "Samples.h"
#include "Output.h"
#include "Instance.h"
#include "TruthTable.h"

class Circuit
{

    Layer *layer_;

    std::map<std::string,Samples> results_;

   TruthTable *truth_table_;


public:
    Circuit(Layer *layer);
    Circuit(Layer *layer,TruthTable * truth_table);
    virtual ~Circuit();

   // void add_output(const Output &output);
   // Output* get_ouput_by_cell_id(int cell_id);
  //  Output* get_ouput_by_cell_name(std::string name);

    std::vector<std::vector<Samples> >  execute_circuit(Instance &instance);

    void set_truth_table(TruthTable * truth_table);
    TruthTable * truth_table();
    static int define_start_index(Samples & clock_sample);
    static int compare_values(double a,double b);

    static std::vector<Samples> generate_samples(Samples & sample,Samples & clock_sample,int num_inputs, int shift,int start_index);

    std::map<std::string,Samples> results() const;

    Layer * layer(){ return layer_;}
    void layer(Layer * layer){  layer_ = layer; }
};

#endif /* CIRCUIT_H_ */
